<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/commons/taglibs.jsp" %>
<script type="text/javascript">
//选择事件
function S_NodeCheck(e, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj(treeId),
        nodes = zTree.getCheckedNodes(true)
    var ids = '', names = ''
    
    for (var i = 0; i < nodes.length; i++) {
        ids   += ','+ nodes[i].id
        names += ','+ nodes[i].name
    }
    if (ids.length > 0) {
        ids = ids.substr(1), names = names.substr(1)
    }
    $("#parentId").val(ids);
    var $from = $('#'+ treeId).data('fromObj')
    
    if ($from && $from.length) $from.val(names)
}
//单击事件
function S_NodeClick(event, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj(treeId)
    
    zTree.checkNode(treeNode, !treeNode.checked, true, true)
    
    event.preventDefault()
}

</script>

<div class="bjui-pageHeader">
       <form id="pagerForm" data-toggle="ajaxsearch" action="${ctx}/management/menu/pageList.do" method="post">
        <input type="hidden" name="pageSize" value="${vo.pageSize}">
        <input type="hidden" name="pageCurrent" value="${vo.pageCurrent}">
        <input type="hidden" name="orderField" value="${vo.orderField}">
        <input type="hidden" name="orderDirection" value="${vo.orderDirection}">    
       <div class="bjui-searchBar">
              <label class="control-label x100">所属系统：</label>
              <select class="selectpicker show-tick" name="sysCode"  data-toggle="selectpicker" >
                		<c:forEach var="sysObj" items="${systemList}">
                			 <option value="${sysObj.sysCode}" <c:if test="${sysObj.sysCode eq param.sysCode}">selected="selected"</c:if>>${sysObj.attrName}</option>
                 	 </c:forEach>
              </select>
	                        
            <label class="control-label x100">父菜单：</label>
             <input type="hidden" id="parentId"  name="parentId" value="${param.parentId}">
             <input type="text" id="parentName" name="parentName" value="${param.parentName}" data-toggle="selectztree" size="18" data-tree="#j_select_tree2" readonly>
              <ul id="j_select_tree2" class="ztree hide" data-toggle="ztree" data-expand-all="true" data-check-enable="true" data-chk-style="radio" data-radio-type="all" data-on-check="S_NodeCheck" data-on-click="S_NodeClick">
              	<c:forEach var="menu" items="${menuList}">
               	 	<li data-id="${menu.intID}" data-pid="${menu.parentId}">${menu.menuName}</li>
                </c:forEach>
            </ul>
            <label>菜单名：</label><input type="text" name="menuName" value="${param.menuName}" class="form-control" size="10" />
            <button type="submit" class="btn-default" data-icon="search">查询</button>
            <a class="btn btn-orange" href="javascript:;" data-toggle="reloadsearch" data-clear-query="true" data-icon="undo">清空查询</a>
            <div class="pull-right">
                <div class="btn-group">
                    <button type="button" class="btn-default dropdown-toggle" data-toggle="dropdown" data-icon="copy">功能操作<span class="caret"></span></button>
                    <ul class="dropdown-menu right" role="menu">
                    	<li><a href="${ctx}/management/menu/initAdd.do" data-toggle="dialog" data-width="500" data-height="350" data-id="dialog-mask" data-mask="true"><i class="fa fa-plus"></i> 新增数据</a></li>
                   		<li class="divider"></li>
                        <li><a href="${ctx}/management/menu/deleteAll.do" data-toggle="doajaxchecked" data-confirm-msg="确定要删除选中项吗？" data-idname="delids" data-group="ids"><i class="fa fa-remove"></i>删除选中</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </form>
</div>

<div class="bjui-pageContent">
    <table data-width="100%"  class="table table-bordered table-hover table-striped table-top" data-toggle="tablefixed">
    	<thead>
    	<tr>
    	   <th width="26"><input type="checkbox" class="checkboxCtrl" data-group="ids" data-toggle="icheck"></th>
    		<th>菜单名</th>
    		<th>菜单路径</th>
    		<th>菜单目标</th>
    		<th class="orderby" data-order-direction="asc" data-order-field="parentId">父菜单</th>
    		<th>操作</th>
    	</tr>
    	</thead>
    	<tbody>
    	<c:forEach var="list" items="${objList}">
    	<tr>
    		<td><input type="checkbox" name="ids"  data-toggle="icheck" value="${list.intID}"></td>
    		<td>${list.menuName}</td>
    		<td>${list.menuUrl}</td>
    		<td>${list.menuTarget}</td>
    		<td>${list.parentName}</td>
    		<td>
    			<a href="${ctx}/management/menu/func/${list.intID}/funcList.do" class="btn btn-default" data-toggle="dialog" data-width="500" data-height="350" data-id="dialog-mask" data-mask="true">功能设置</a>
    			<a href="${ctx}/management/menu/${list.intID}/initEdit.do" class="btn btn-default" data-toggle="dialog" data-width="500" data-height="350" data-id="dialog-mask" data-mask="true">编辑</a>
    			<a href="${ctx}/management/menu/${list.intID}/delete.do" class="btn btn-red" data-toggle="doajax" data-confirm-msg="确定要删除吗？">删除</a>
    		</td>
    	</tr>
    	</c:forEach>
    	</tbody>
    </table>
</div>

<%@ include file="/commons/pagination.jsp" %>

